import 'package:flutter/material.dart';
import 'package:totaldemo/pages/evaluation/fill_questionnaire.dart';
import 'package:totaldemo/pages/evaluation/wait_seach_page.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:Smart/utils/screen_unit/gs_screen_util.dart';
// import '../lib/utils/Screen_unit/oa_screen_until.dart';
// import './oa_screen_until.dart';
// import 'package:utils/Screen_unit/screen_unit.dart';
import '../../utils/screen_unit.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///待我评教
class WaitEvaluationWidget extends StatefulWidget {
  const WaitEvaluationWidget({Key key}) : super(key: key);

  @override
  _WaitEvaluationWidgetState createState() => _WaitEvaluationWidgetState();
}

class _WaitEvaluationWidgetState extends State<WaitEvaluationWidget> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        GestureDetector(
          onTap: () {
            print('点击了搜索');
            Get.to(WaitSeachPage());
          },
          child: Container(
            height: 35.w,
            width: 379.w,
            margin: EdgeInsets.only(top: 11.w, right: 18.w, left: 18.w),
            decoration: BoxDecoration(
                color: Color(0xffEDEDED),
                borderRadius: BorderRadius.all(Radius.circular(4))),
            child: Padding(
              padding: EdgeInsets.all(10.w),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Icon(
                    Icons.search,
                    size: 20.w,
                  ),
                  Text(
                    '请输入问卷标题',
                    style: TextStyle(color: Color(0xff000000), fontSize: 13.w),
                  )
                ],
              ),
            ),
          ),
        ),
        Expanded(
          child: ListView(
            children: [
              // Text('data'),
              questionnaireItem(
                  name: '朱唠嗑',
                  title: '对老师的评教',
                  term: '2020-2021下学期',
                  startTime: '2021-03-11',
                  endTime: '2021-03-23'),
              questionnaireItem(
                  name: '朱唠嗑',
                  title: '对老师的评教',
                  term: '2020-2021下学期',
                  startTime: '2021-03-11',
                  endTime: '2021-03-23'),
            ],
          ),
        )
      ],
    );
  }

  Widget questionnaireItem({
    String imgUrl,
    String name,
    String title,
    String term,
    String startTime,
    String endTime,
  }) {
    return Stack(
      children: [
        Container(
          width: 361.w,
          height: 127.w,
          decoration: BoxDecoration(
            // color: Colors.red,
            borderRadius: BorderRadius.all(
              Radius.circular(1.w),
            ),
            boxShadow: [
              BoxShadow(
                  color: Colors.black12,
                  offset: Offset(0, 0), //阴影xy轴偏移量
                  blurRadius: 50.0, //阴影模糊程度
                  spreadRadius: 3.0.w //阴影扩散程度
                  ),
            ],
          ),
          margin: EdgeInsets.only(top: 17.w, left: 35.w, right: 18.w),
          child: Container(
            padding: EdgeInsets.only(left: 43.w),
            color: Colors.white,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  name,
                  style: TextStyle(color: Colors.grey, fontSize: 13.w),
                ),
                Text(
                  term,
                  style: TextStyle(color: Color(0xff666666), fontSize: 13.w),
                ),
                Text(
                  title,
                  style: TextStyle(color: Color(0xff333333), fontSize: 15.w),
                ),
                Row(
                  // crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Icon(
                      Icons.timer,
                      size: 14.w,
                    ),
                    SizedBox(
                      width: 6.w,
                    ),
                    Text(
                      startTime,
                      style:
                          TextStyle(color: Color(0xff666666), fontSize: 13.w),
                    ),
                    Container(
                      width: 46.w,
                      margin: EdgeInsets.symmetric(horizontal: 14.w),
                      child: Divider(
                        thickness: 2.w,
                        color: Color(0xff7248D7),
                      ),
                    ),
                    Text(
                      endTime,
                      style:
                          TextStyle(color: Color(0xff666666), fontSize: 13.w),
                    ),
                  ],
                )
              ],
            ),
          ),
        ),
        Positioned(
          left: 20.w,
          // right: 30.w,
          top: 30.w,
          child: ClipRRect(
              borderRadius: BorderRadius.all(
                Radius.circular(8),
              ),
              child: Image.network(
                  'https://img0.baidu.com/it/u=1682050408,2246241836&fm=26&fmt=auto&gp=0.jpg',
                  // color: Color(0xff5838A8),
                  width: 50.w,
                  height: 50.w)),
        ),
        Positioned(
            // left: 20.w,
            right: 35.w,
            top: 40.w,
            child: GestureDetector(
              onTap: () {
                print('点击填写');
                Get.to(FillQuestionairePage());
              },
              child: Container(
                height: 24.w,
                width: 57.w,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(5)),
                    color: Color(0xff6F4BC6)),
                child: Center(
                  child: Text(
                    '填写',
                    style: TextStyle(color: Colors.white),
                  ),
                ),
              ),
            )),
      ],
    );
  }
}
